/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.dao.ibatis;

import model.dao.SolicitudAsambleaDao;
import com.ibatis.sqlmap.client.SqlMapClient;
import model.bean.SolicitudAsamblea;
import java.util.List;
import java.util.Map;
import model.common.ibatis.IbatisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

/**
 * @Archivo SolicitudAsambleaDaoIbatis.java
 * @Fecha                @Autor   @Cambios
 * 21/01/2011 04:06:26 PM       moshiro
 */
@Repository
public class SolicitudAsambleaDaoIbatis extends SqlMapClientDaoSupport implements SolicitudAsambleaDao {

    @Autowired
    public SolicitudAsambleaDaoIbatis(SqlMapClient arg) {
        setSqlMapClient(arg);
    }

    public Long agregarSolicitudAsamblea(SolicitudAsamblea solicitudAsamblea) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(solicitudAsamblea);
        return ((Long)getSqlMapClientTemplate().queryForObject("agregarSolicitudAsamblea", parameterMap)).longValue();
    }

    public Integer modificarSolicitudAsamblea(SolicitudAsamblea solicitudAsamblea) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(solicitudAsamblea);
        return ((Integer)getSqlMapClientTemplate().update("modificarSolicitudAsamblea", parameterMap));
    }

    public Integer eliminarSolicitudAsamblea(Long codigo) throws DataAccessException {
        SolicitudAsamblea SolicitudAsamblea = new SolicitudAsamblea();
        SolicitudAsamblea.setCodigo(codigo);
        return ((Integer)getSqlMapClientTemplate().delete("eliminarSolicitudAsamblea", SolicitudAsamblea));
    }

    public List<SolicitudAsamblea> listarSolicitudAsamblea(SolicitudAsamblea solicitudAsamblea) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(solicitudAsamblea);
        return getSqlMapClientTemplate().queryForList("listarSolicitudAsamblea", parameterMap);
    }

    public SolicitudAsamblea obtenerSolicitudAsamblea(SolicitudAsamblea solicitudAsamblea) throws DataAccessException {
        Map parameterMap = IbatisUtils.processBean(solicitudAsamblea);
        return (SolicitudAsamblea) getSqlMapClientTemplate().queryForObject("listarSolicitudAsamblea", parameterMap);
    }

}
